package cc.messcat.service.map;

import cc.messcat.common.service.BaseServiceImpl;
import cc.messcat.dao.map.PovertyMapDao;
import cc.messcat.entity.map.MapPoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 扶贫地图业务层实现
 *
 * @author Administrator
 * @create 2018-06-10 15:14
 **/
@Service
public class PovertyMapServiceImpl extends BaseServiceImpl<MapPoint> implements PovertyMapService {
    @Autowired
    private PovertyMapDao povertyMapDao;

    @Override
    public Long addMapPoint(MapPoint mapPoint) {
        return povertyMapDao.save1(mapPoint);
    }

    @Override
    public Map<String, Object> queryMapPointInfo(Long pointId, String pointType) {
        if (pointType.indexOf("company") > -1) {
            return povertyMapDao.queryCompanyMapPointInfo(pointId);
        } else {
            return povertyMapDao.queryVillageMapPointInfo(pointId);
        }
    }

    @Override
    public void modifyMapPointBysql(MapPoint mapPoint) {
        povertyMapDao.modifyMapPointBysql(mapPoint);
    }

    @Override
    public List<MapPoint> queryMapPointsBypPointTypes(String[] pointTypes) {
        return povertyMapDao.queryMapPointsBypPointTypes(pointTypes);
    }
}
